(function($){
	
	$(function(){
		// Bootstrap tooltip
		$(".tip").tooltip({
			placement: 'top', 
			trigger: 'hover'
		});
		$(".tipb").tooltip({
			placement: 'bottom', 
			trigger: 'hover'
		});
		$(".tipl").tooltip({
			placement: 'left', 
			trigger: 'hover'
		});
		$(".tipr").tooltip({
			placement: 'right', 
			trigger: 'hover'
		});
                 
		// Uniform
		$("input:checkbox, input:radio").not('input.ibtn').uniform();    
		// Select2
		if($(".select").length){
			$(".select").select2();
			$(".select").on("change", function(e) {             
				//action
				});
		}    
    
		// Validation
		if($("form.validate").length > 0 && $.validationEngine){
			$("form.validate").validationEngine('attach',{
				promptPosition : "topLeft"
			});
		}
		
    
		if($(".datepicker").length > 0){
        
			$( ".datepicker" ).datepicker({
				//dateFormat: 'dd-mm-yy',
				dateFormat: 'yy-mm-dd',
				onSelect: function(date){
				//action
				}
			});
		}
     
    
		// accordion
		if($(".accordion").length > 0) {
			$(".accordion").accordion({
				heightStyle: "content"
			});
		}
		// eof accordion
    
		// tabs
		if($(".tabs").length > 0) {
			$(".tabs").tabs();
		}
		// eof tabs

    
		// spinner
		$( ".spinner" ).spinner();
    
		// dataTable    
		if($("table.paginate").length > 0){
			$("table.paginate").dataTable({
				bSort: true, 
				bAutoWidth: true,
				"iDisplayLength": 25, 
				"aLengthMenu": [25,50,100], // can be removed for basic 10 items per page
				"sPaginationType": "full_numbers",
				"aoColumnDefs": [{
					"bSortable": false,
					"aTargets": [ -1 , 0]
				}]
			});
		}
        
		// eif dataTable    
   
		// eof draggable blocks
                    
		// new selector case insensivity        
		$.expr[':'].containsi = function(a, i, m) {
			return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
		};
	
	
		$('.wrapper').resize(function(){

			//if($("#wysiwyg").length > 0) editor.refresh();
			//if($("#mail_wysiwyg").length > 0) m_editor.refresh();
    
			});
	});
		
	$(window).load(function(){

		// custom scrollbar        
		if($(".scroll").length > 0){
			$(".scroll").mCustomScrollbar();
		}

	});

})(jQuery);
